home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung / Power-Programmierung (Tewi)(1994).iso / magazine / progjour / 1988 / 04 / smltpl.c < prev    next >
Text File  |  1988-04-28  |  1KB  |  59 lines

  1. /* 
  2.    Resident segment for the Windows small memory model template
  3. */
  4.  
  5. #include <windows.h>
  6.  
  7. #define EXTERN        /* all global variables declared in this module */
  8. #include "smltpl.h"
  9.  
  10. /* Entry point for program */
  11. int PASCAL WinMain(hInstance, hPrevInstance, lpszCmdLine, cmdShow)
  12. HANDLE hInstance, hPrevInstance;
  13. LPSTR lpszCmdLine;
  14. int cmdShow;
  15. {
  16.  
  17.     MSG msg;
  18.  
  19.   /* If initialization is not successful then exit */
  20.     if (!InitProgram(hInstance,hPrevInstance, lpszCmdLine, cmdShow))
  21.     return FALSE;
  22.  
  23.   /* Retrieve messages from Windows */
  24.     while (GetMessage((LPMSG)&msg,NULL,0,0)) {
  25.     TranslateMessage((LPMSG)&msg);
  26.     DispatchMessage((LPMSG)&msg);
  27.     }
  28.     return msg.wParam;        /* exit program */
  29. }
  30.  
  31. /* All messages are processed here */
  32. long FAR PASCAL MainWndProc(hWnd,message,wParam,lParam)
  33. HWND hWnd;
  34. unsigned message;
  35. WORD wParam;
  36. LONG lParam;
  37. {
  38.  
  39.     PAINTSTRUCT ps;
  40.  
  41.     switch(message) {
  42.  
  43.     case WM_DESTROY:
  44.         PostQuitMessage(0);
  45.         break;
  46.  
  47.     case WM_PAINT:
  48.         BeginPaint(hWnd, (LPPAINTSTRUCT)&ps);
  49.         EndPaint(hWnd, (LPPAINTSTRUCT)&ps);
  50.         break;
  51.  
  52.     default:
  53.         return ((long)DefWindowProc(hWnd,message,wParam,lParam));
  54.         break;
  55.     }
  56.     return(0L);
  57. }
  58.  
  59.